using System;
using System.Collections.Generic;
using System.Text;
using Fieldbook.Entities;
using Fieldbook.DAL;
using Fieldbook.Common;

namespace Fieldbook.Business
{
    public static class MeasureUnitController
    {
        public static List<Measureunit> LoadMeasrueUnits(Measureunit.MeasureCategory category)
        {
            List<Measureunit> res = null;
            try
            {
                string criteria = String.Format(" WHERE CATEGORYID = {0}", (int)category);
                res = MeasureunitDAO.LoadMeasureunits(criteria, "");
            }
            catch (Exception ex)
            {
                LogManager.LogException("Error getting user messages", ex);
            }
            return res;
        }

        public static List<Measureunit> LoadAllMeasureUnits()
        {
            List<Measureunit> res = null;
            try
            {
                res = MeasureunitDAO.LoadMeasureunits("", " ORDER BY CATEGORYID, DESCRIPTION");
            }
            catch (Exception ex)
            {
                LogManager.LogException("Error getting user messages", ex);
            }
            return res;
        }
    }
}
